<template>
  <div>
    <ul>
      <li v-for="m in messageList" :key="m.id">
<!--        query 跳转路由并携带query参数，to的字符串传参写法-->
<!--       <router-link :to="`/home/message/detail/${m.id}/${m.title}`">{{m.title}}</router-link>&nbsp;&nbsp;-->
<!--&lt;!&ndash;      对象写法美观好些好看，传参时&ndash;&gt;-->
        <router-link :to="{
          //写命名路由必须把to写成对象形式
          //若用params传参，则必须用name写，不能写path
          name:'xiangqing',
            // path:'/home/message/detail',
            params:{
              id:m.id,
              title:m.title
            }
        }">
          {{m.title}}
        </router-link>
      </li>
    </ul>
    <hr>
<!--    展示区-->
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "Message",
  data(){
    return {
      messageList:[
        {id:'001',title:'消息001'},
        {id:'002',title:'消息002'},
        {id:'003',title:'消息003'},
      ]
    }
  }
}
</script>

<style scoped>

</style>